package com.kunminx.viabus.business.bus.business;

import com.kunminx.core.bus.Result;
import com.kunminx.viabus.business.NoteBusiness;
import com.kunminx.viabus.business.constant.Configs;
import com.kunminx.viabus.repertory.model.AppDatabase;
import ohos.aafwk.ability.Ability;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.ability.delegation.AbilityDelegatorRegistry;
import ohos.data.DatabaseHelper;
import ohos.data.orm.OrmContext;
import ohos.hiviewdfx.HiLog;
import ohos.hiviewdfx.HiLogLabel;
import org.junit.Before;
import org.junit.Test;


import static org.junit.Assert.*;

public class NoteBusinessTest {

    private static final HiLogLabel LABEL = new HiLogLabel(HiLog.LOG_APP, 0x00201, "MY_TAG");

    private final Ability ability = AbilityDelegatorRegistry.getAbilityDelegator().getCurrentTopAbility();
    private final AbilitySlice abilitySlice = AbilityDelegatorRegistry.getAbilityDelegator().getCurrentAbilitySlice(ability);

    private OrmContext ormContext;
    private DatabaseHelper databaseHelper;

    private NoteBusiness mNoteBusiness;

    private Result result;

    @Before
    public void setUp() throws Exception {
        databaseHelper = new DatabaseHelper(abilitySlice);
        ormContext = databaseHelper.getOrmContext("AppDatabase", Configs.DB_PATH, AppDatabase.class);
    }

    @Test
    public void init() {
        String alias = ormContext.getAlias();
        assertNotNull(ormContext);
        assertEquals("AppDatabase", alias);
    }
}